<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>背景</title>
    <style>
        *{margin:0;padding:0;}
        div{
            /* 子元素不设置width,它会继承父元素的width
            这种继承只发生在块元素之间
             */
            /* 用背景图片加载会快一点，用img加载会慢一点 */
            background-color:#1ABEBF;
            height:100px;
            background-image: url('images/logo.png');
            /*  background-repeat:no-repeat/repeat-x/repeat-y;  */
            background-repeat: no-repeat;
            /* 背景位置横坐标居中 */
            background-position-x:center;
            /* 背景位置纵坐标居中 */
            background-position-y:center;

        }
    
    </style>
</head>
<body>
    <div>

    </div>
</body>
</html>